<?php	
	
include ("./src/jpgraph.php");
include ("./src/jpgraph_line.php");
$graph = new Graph(900,550,"auto");
$graph->SetScale("textlin");

$graph->img->SetMargin(50,30,20,120);    
$graph->SetShadow();

$datax=array("V","Tomm","Atda","Boto","Tojo","mCm","Dres","Fran","Trep","Trem","Aren","Llvi","Llde","Cara","Ashg","Ldov","Wenl","Ludl","Prid","Gedi","Sieg","Emsi","Eife","Give","Fras","Fame","Tour","Vise","Serp","Bash","Mosc","Step","wolf","Leon","Guad","Tatr","Indu","Olen","Anis","Ladi","Carn","Nori","Hett","Sine","Plie","Toar","Aale","Bajo","Bath","Call","Oxfo","Kimm","Tith","Berr","Vala","Haut","Barr","Apti","Albi","Ceno","Turo","Coni","Sant","Camp","Maas","Dani","Than","Eo-l","Eo-m","Eo-u","Ol-l","Ol-u","Mi-l","Mi-m","Mi-u","Plio-l","Plio-u","Plei-l","Plei-u","R");
$datay=array("48","100","238","361","221","594","380","382","308","327","366","278","308","365","277","164","179","160","128","176","198","256","259","110","67","72","82","82","53","54","58","48","42","45","43","27","20","21","32","28","24","27","24","27","28","32","32","33","33","35","39","40","43","44","45","47","48","51","51","62","60","62","64","73","73","63","60","61","62","60","57","57","57","57","57","56","56","53","53","53");

$datay2=array("3","3","22","15","10","21","7","6","17","51","112","114","135","225","223","164","245","298","216","245","280","299","315","296","269","213","262","322","293","256","304","277","298","363","377","260","178","199","245","395","430","423","297","347","377","389","379","460","491","486","596","603","622","511","526","539","542","662","748","1129","1027","1115","1205","1466","1541","1004","1250","1864","2394","2364","2291","2390","3134","3263","3317","3375","3376","3274","3274","3248");

$datay3=array("3","3","8","18","15","25","17","18","62","130","433","421","445","790","741","657","819","765","536","715","787","1073","1142","893","668","659","721","986","659","575","604","613","795","857","759","377","80","190","257","232","353","417","178","282","338","329","318","477","462","507","506","470","496","385","442","443","454","481","548","544","499","502","518","576","574","288","257","315","324","332","310","323","388","400","399","353","357","331","331","325");


$graph->title->Set('Sepkoski Curve of Diversity');
$graph->title->SetFont(FF_FONT1,FS_BOLD);


$dplot = new LinePLot($datay);
$dplot2 = new LinePLot($datay2);
$dplot3 = new LinePLot($datay3);

$dplot->SetFillColor("blue");
$dplot2->SetFillColor("green");
$dplot3->SetFillColor("red");

$dplot->SetLegend("Cm");
$dplot2->SetLegend("Md");
$dplot3->SetLegend("Pz");


// Create the accumulated graph
$accplot = new AccLinePlot(array($dplot,$dplot3, $dplot2));

// Add the plot to the graph
$graph->Add($accplot);

//$p1 = new LinePlot($datay);
//$p1->SetFillColor("blue");
//$p1->mark->SetType(MARK_FILLEDCIRCLE);
//$p1->mark->SetFillColor("red");
//$p1->mark->SetWidth(4);
$graph->yaxis->title->SetMargin(10);

$graph->yaxis->title->Set("Number of Genera");
$graph->xaxis->SetTickLabels($datax);
$graph->xaxis->SetLabelAngle(90);
$graph->xaxis->title->SetMargin(80);
$graph->xaxis->title->Set("Stage Interval");

$graph->Stroke();
?>